package First.HomeWork.Work02;

public class Student extends Person{
    private int no;
    private double scoreEn;
    private double scoreMath;
    private double scoreCh;

    public Student(int no,double scoreEn,double scoreCh,double scoreMath){
        super();
        this.no=no;
        this.scoreEn=scoreEn;
        this.scoreCh=scoreCh;
        this.scoreMath=scoreMath;
    }

    public Student() {

    }

    public int getNo() {
        return no;
    }

    public void setNo(int no) {
        this.no = no;
    }

    public double getScoreEn() {
        return scoreEn;
    }

    public void setScoreEn(double scoreEn) {
        this.scoreEn = scoreEn;
    }

    public double getScoreMath() {
        return scoreMath;
    }

    public void setScoreMath(double scoreMath) {
        this.scoreMath = scoreMath;
    }

    public double getScoreCh() {
        return scoreCh;
    }

    public void setScoreCh(double scoreCh) {
        this.scoreCh = scoreCh;
    }
    public double aver(){
        double averageScore = (scoreCh+scoreEn+scoreMath)/3;
        return averageScore;
    }
    public double max() {
        double max = Math.max(this.scoreMath,this.scoreCh);
        double max2 = Math.max(max,this.scoreEn);
        return max2;
    }
    public double min(){
        double min = Math.min(this.scoreMath,this.scoreEn);
        double min2 = Math.min(min,this.scoreEn);
        return min2;
    }

    @Override
    public String toString() {
        return super.toString()+
                "Student{" +
                "no=" + no +
                ", scoreEn=" + scoreEn +
                ", scoreMath=" + scoreMath +
                ", scoreCh=" + scoreCh +
                ", aver=" + aver() +
                ", max=" + max() +
                ", min=" + min() +
                '}';
    }
}
